package com.hyl.domain.activity.service.trial.thread;

import com.hyl.domain.activity.adapter.repository.IActivityRepository;
import com.hyl.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import com.hyl.domain.activity.model.valobj.SCSkuActivityVO;

import javax.annotation.Resource;
import java.util.concurrent.Callable;

/**
 * @author hyl
 * @description
 * @create 2025-06-16 15:26
 */
public class QueryGroupActivityDiscountVOThreadTask implements Callable<GroupBuyActivityDiscountVO> {


    public QueryGroupActivityDiscountVOThreadTask(IActivityRepository repository, String source, String channel, String scGoodsId) {
        this.repository = repository;
        this.source = source;
        this.channel = channel;
        this.scGoodsId = scGoodsId;
    }

    private final IActivityRepository  repository;
    private final String source;
    private final String channel;   //渠道
    private final String scGoodsId;



    @Override
    public GroupBuyActivityDiscountVO call() throws Exception {
        SCSkuActivityVO scSkuActivityVO = repository.querySCSkuActivityBySCGoodsId(source,channel,scGoodsId);
        if (null == scSkuActivityVO)return null;

        return repository.queryGroupBuyActivityDiscountVO(scSkuActivityVO.getActivityId());
    }
}
